home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / DriverGestalt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-15  |  10.3 KB  |  284 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        DriverGestalt.h
  3.  
  4.      Contains:    Driver Gestalt interfaces
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2.
  7.                  Package:    Universal Interfaces 2.1.2 on ETO #20
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __DRIVERGESTALT__
  21. #define __DRIVERGESTALT__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __OSUTILS__
  30. #include <OSUtils.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33. /*    #include <Memory.h>                                            */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT_SUPPORTED
  44. #pragma import on
  45. #endif
  46.  
  47.  
  48. enum {
  49.     kbDriverGestaltEnable        = 2,
  50.     kmDriverGestaltEnableMask    = (1 << kbDriverGestaltEnable)
  51. };
  52.  
  53. /*__________________________________________________________________________________*/
  54. /* Driver Gestalt related csCodes */
  55. enum {
  56.     kDriverGestaltCode            = 43,                            /* various uses */
  57.     kDriverConfigureCode        = 43,                            /* various uses */
  58.     kdgLowPowerMode                = 70,                            /* Sets/Returns the current energy consumption level */
  59.     kdgReturnDeviceID            = 120,                            /* returns SCSI DevID in csParam[0] */
  60.     kdgGetCDDeviceInfo            = 121                            /* returns CDDeviceCharacteristics in csParam[0] */
  61. };
  62.  
  63. /*__________________________________________________________________________________*/
  64. /* Driver Gestalt selectors */
  65. enum {
  66.     kdgVersion                    = 'vers',                        /* Version number of the driver in standard Apple format */
  67.     kdgDeviceType                = 'devt',                        /* The type of device the driver is driving. */
  68.     kdgInterface                = 'intf',                        /* The underlying interface that the driver is using (if any) */
  69.     kdgSync                        = 'sync',                        /* True if driver only behaves synchronously. */
  70.     kdgBoot                        = 'boot',                        /* value to place in PRAM for this drive (long) */
  71.     kdgWide                        = 'wide',                        /* True if driver supports ioWPosOffset */
  72.     kdgPurge                    = 'purg',                        /* Driver purge permission (True = purge; False = no purge) */
  73.     kdgSupportsSwitching        = 'lpwr',                        /* True if driver supports power switching */
  74.     kdgMin3VPower                = 'pmn3',                        /* Minimum 3.3V power consumption in microWatts */
  75.     kdgMin5VPower                = 'pmn5',                        /* Minimum 5V power consumption in microWatts */
  76.     kdgMax3VPower                = 'pmx3',                        /* Maximum 3.3V power consumption in microWatts */
  77.     kdgMax5VPower                = 'pmx5',                        /* Maximum 5V power consumption in microWatts */
  78.     kdgInHighPower                = 'psta',                        /* True if device is currently in high power mode */
  79.     kdgSupportsPowerCtl            = 'psup',                        /* True if driver supports following five calls */
  80.     kdgAPI                        = 'dAPI',                        /* API support for PC Exchange */
  81.     kdgEject                    = 'ejec'
  82. };
  83.  
  84. /*__________________________________________________________________________________*/
  85. /* status parameter block for Driver Gestalt calls */
  86. struct DriverGestaltParam {
  87.     QElemPtr                        qLink;
  88.     short                            qType;
  89.     short                            ioTrap;
  90.     Ptr                                ioCmdAddr;
  91.     ProcPtr                            ioCompletion;
  92.     OSErr                            ioResult;
  93.     StringPtr                        ioNamePtr;
  94.     short                            ioVRefNum;
  95.     short                            ioCRefNum;                    /* refNum for I/O operation */
  96.     short                            csCode;                        /*    == kDriverGestaltCode */
  97.     OSType                            driverGestaltSelector;        /* 'sync', 'vers', etc. */
  98.     UInt32                            driverGestaltResponse;        /* Could be a pointer, bit field or other format */
  99.     UInt32                            driverGestaltResponse1;        /* Could be a pointer, bit field or other format */
  100.     UInt32                            driverGestaltResponse2;        /* Could be a pointer, bit field or other format */
  101.     UInt32                            driverGestaltResponse3;        /* Could be a pointer, bit field or other format */
  102.     UInt16                            driverGestaltfiller;        /* To pad out to the size of a controlPB */
  103. };
  104. typedef struct DriverGestaltParam DriverGestaltParam;
  105.  
  106. /* Note that the various response definitions are overlays of the response fields above.
  107.    For instance the deviceType response would be returned in driverGestaltResponse.
  108.    The DriverGestaltPurgeResponse would be in driverGestaltResponse and driverGestaltResponse1
  109. */
  110. /*__________________________________________________________________________________*/
  111. /* Device Types response */
  112. struct DriverGestaltDevTResponse {
  113.     OSType                            deviceType;
  114. };
  115. typedef struct DriverGestaltDevTResponse DriverGestaltDevTResponse;
  116.  
  117.  
  118. enum {
  119.     kdgDiskType                    = 'disk',                        /* standard r/w disk drive */
  120.     kdgTapeType                    = 'tape',                        /* tape drive */
  121.     kdgPrinterType                = 'prnt',                        /* printer */
  122.     kdgProcessorType            = 'proc',                        /* processor */
  123.     kdgWormType                    = 'worm',                        /* write-once */
  124.     kdgCDType                    = 'cdrm',                        /* cd-rom drive */
  125.     kdgFloppyType                = 'flop',                        /* floppy disk drive */
  126.     kdgScannerType                = 'scan',                        /* scanner */
  127.     kdgFileType                    = 'file',                        /* Logical Partition type based on a file (Drive Container) */
  128.     kdgRemovableType            = 'rdsk'
  129. };
  130.  
  131. /*__________________________________________________________________________________*/
  132. /* Device Interfaces response */
  133. struct DriverGestaltIntfResponse {
  134.     OSType                            interfaceType;
  135. };
  136. typedef struct DriverGestaltIntfResponse DriverGestaltIntfResponse;
  137.  
  138.  
  139. enum {
  140.     kdgScsiIntf                    = 'scsi',
  141.     kdgPcmciaIntf                = 'pcmc',
  142.     kdgATAIntf                    = 'ata ',
  143.     kdgFireWireIntf                = 'fire',
  144.     kdgExtBus                    = 'card'
  145. };
  146.  
  147. /*__________________________________________________________________________________*/
  148. /* Power Saving */
  149. struct DriverGestaltPowerResponse {
  150.     unsigned long                    powerValue;                    /* Power consumed in µWatts */
  151. };
  152. typedef struct DriverGestaltPowerResponse DriverGestaltPowerResponse;
  153.  
  154. /*__________________________________________________________________________________*/
  155. /* Disk Specific */
  156. struct DriverGestaltSyncResponse {
  157.     Boolean                            behavesSynchronously;
  158.     UInt8                            pad[3];
  159. };
  160. typedef struct DriverGestaltSyncResponse DriverGestaltSyncResponse;
  161.  
  162. struct DriverGestaltBootResponse {
  163.     UInt8                            extDev;                        /*  Packed target (upper 5 bits) LUN (lower 3 bits) */
  164.     UInt8                            partition;                    /*  Unused */
  165.     UInt8                            SIMSlot;                    /*  Slot */
  166.     UInt8                            SIMsRSRC;                    /*  sRsrcID */
  167. };
  168. typedef struct DriverGestaltBootResponse DriverGestaltBootResponse;
  169.  
  170. struct DriverGestaltAPIResponse {
  171.     short                            partitionCmds;                /* if bit 0 is nonzero, supports partition control and status calls
  172.                                      prohibitMounting (control, kProhibitMounting)
  173.                                      partitionToVRef (status, kGetPartitionStatus)
  174.                                      getPartitionInfo (status, kGetPartInfo) */
  175.     short                            unused1;                    /* all the unused fields should be zero */
  176.     short                            unused2;
  177.     short                            unused3;
  178.     short                            unused4;
  179.     short                            unused5;
  180.     short                            unused6;
  181.     short                            unused7;
  182.     short                            unused8;
  183.     short                            unused9;
  184.     short                            unused10;
  185. };
  186. typedef struct DriverGestaltAPIResponse DriverGestaltAPIResponse;
  187.  
  188. /* Flags for purge permissions */
  189.  
  190. enum {
  191.     kbCloseOk                    = 0,                            /* Ok to call Close */
  192.     kbRemoveOk                    = 1,                            /* Ok to call RemoveDrvr */
  193.     kbPurgeOk                    = 2,                            /* Ok to call DisposePtr */
  194.     kmNoCloseNoPurge            = 0,
  195.     kmOkCloseNoPurge            = (1 << kbCloseOk) + (1 << kbRemoveOk),
  196.     kmOkCloseOkPurge            = (1 << kbCloseOk) + (1 << kbRemoveOk) + (1 << kbPurgeOk)
  197. };
  198.  
  199. /* Driver purge permission structure */
  200. struct DriverGestaltPurgeResponse {
  201.     UInt16                            purgePermission;            /* 0 = Do not change the state of the driver */
  202. /* 3 = Do Close() and DrvrRemove() this driver */
  203. /* but don't deallocate driver code */
  204. /* 7 = Do Close(), DrvrRemove(), and DisposePtr() */
  205.     UInt16                            purgeReserved;
  206.     Ptr                                purgeDriverPointer;            /* pointer to the start of the driver block (valid */
  207. /* only of DisposePtr permission is given */
  208. };
  209. typedef struct DriverGestaltPurgeResponse DriverGestaltPurgeResponse;
  210.  
  211. struct DriverGestaltEjectResponse {
  212.     UInt32                            ejectFeatures;                /*  */
  213. };
  214. typedef struct DriverGestaltEjectResponse DriverGestaltEjectResponse;
  215.  
  216. /* Flags for Ejection Features field */
  217.  
  218. enum {
  219.     kRestartDontEject            = 0,                            /* Dont Want eject during Restart */
  220.     kShutDownDontEject            = 1,                            /* Dont Want eject during Shutdown */
  221.     kRestartDontEject_Mask        = 1 << kRestartDontEject,
  222.     kShutDownDontEject_Mask        = 1 << kShutDownDontEject
  223. };
  224.  
  225. /*__________________________________________________________________________________*/
  226. /* CD-ROM Specific */
  227. /* The CDDeviceCharacteristics result is returned in csParam[0] and csParam[1] of a 
  228.    standard CntrlParam parameter block called with csCode kdgGetCDDeviceInfo.
  229. */
  230. struct CDDeviceCharacteristics {
  231.     UInt8                            speedMajor;                    /* High byte of fixed point number containing drive speed */
  232.     UInt8                            speedMinor;                    /* Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc. */
  233.     UInt16                            cdFeatures;                    /* Flags field for features and transport type of this CD-ROM */
  234. };
  235. typedef struct CDDeviceCharacteristics CDDeviceCharacteristics;
  236.  
  237.  
  238. enum {
  239.     cdFeatureFlagsMask            = 0xFFFC,                        /* The Flags are in the first 14 bits of the cdFeatures field */
  240.     cdTransportMask                = 0x0003                        /* The transport type is in the last 2 bits of the cdFeatures field */
  241. };
  242.  
  243. /* Flags for CD Features field */
  244. enum {
  245.     cdMute                        = 0,                            /* The following flags have the same bit number */
  246.     cdLeftToChannel                = 1,                            /* as the Audio Mode they represent.  Don't change */
  247.     cdRightToChannel            = 2,                            /* them without changing dControl.c */
  248.     cdLeftPlusRight                = 3,                            /* Reserve some space for new audio mixing features (4-7) */
  249.     cdSCSI_2                    = 8,                            /* Supports SCSI2 CD Command Set */
  250.     cdStereoVolume                = 9,                            /* Can support two different volumes (1 on each channel) */
  251.     cdDisconnect                = 10,                            /* Drive supports disconnect/reconnect */
  252.     cdWriteOnce                    = 11,                            /* Drive is a write/once (CD-R?) type drive */
  253.     cdMute_Mask                    = 1 << cdMute,
  254.     cdLeftToChannel_Mask        = 1 << cdLeftToChannel,
  255.     cdRightToChannel_Mask        = 1 << cdRightToChannel,
  256.     cdLeftPlusRight_Mask        = 1 << cdLeftPlusRight,
  257.     cdSCSI_2_Mask                = 1 << cdSCSI_2,
  258.     cdStereoVolume_Mask            = 1 << cdStereoVolume,
  259.     cdDisconnect_Mask            = 1 << cdDisconnect,
  260.     cdWriteOnce_Mask            = 1 << cdWriteOnce
  261. };
  262.  
  263. /* Transport types */
  264. enum {
  265.     cdCaddy                        = 0,                            /* CD_SC,CD_SC_PLUS,CD-300 etc. */
  266.     cdTray                        = 1,                            /* CD_300_PLUS etc. */
  267.     cdLid                        = 2                                /* Power CD - eg no eject mechanism */
  268. };
  269.  
  270.  
  271. #if PRAGMA_IMPORT_SUPPORTED
  272. #pragma import off
  273. #endif
  274.  
  275. #if PRAGMA_ALIGN_SUPPORTED
  276. #pragma options align=reset
  277. #endif
  278.  
  279. #ifdef __cplusplus
  280. }
  281. #endif
  282.  
  283. #endif /* __DRIVERGESTALT__ */
  284.